using SimpleSpreadsheet.Core.Expressions;

namespace SimpleSpreadsheet.Core
{
    /// <summary>
    /// Base class for all expression evaluators
    /// </summary>
    public abstract class ExpressionVisitor
    {
        public abstract void Visit(BaseExpression expression);
        public abstract void Visit(BinaryExpresssion expression);
        public abstract void Visit(UnaryExpression expression);
        public abstract void Visit(ValueExpression expression);
        public abstract void Visit(FunctionExpression functionExpression);
        public abstract void Visit(ReferenceExpression function);
        public abstract void Visit(ParameterExpression function);
        public abstract object Evaluate(BaseExpression expression);
        public event EvaluateParameterHandler EvaluateParameter;

        protected void OnEvaluateParameter(string name, ParameterArgs args)
        {
            if (EvaluateParameter != null)
                EvaluateParameter(name, args);
        }
    }
}